package com.woyao.core.service;

import com.woyao.core.model.BaseResponse;
import com.woyao.core.model.GetBalanceResponse;
import com.woyao.core.model.GetContactResponse;
import com.woyao.core.model.GetDemandResponse;
import com.woyao.core.model.GetMemberResponse;
import com.woyao.core.model.GetMessageResponse;
import com.woyao.core.model.GetMyCompanyResponse;
import com.woyao.core.model.GetMyContactResponse;
import com.woyao.core.model.GetMyDemandResponse;
import com.woyao.core.model.GetMyMemberResponse;
import com.woyao.core.model.GetMyRelationResponse;
import com.woyao.core.model.GetOrgResponse;
import com.woyao.core.model.GetRelationResponse;
import com.woyao.core.model.LoginResponse;
import com.woyao.core.model.ProfileResponse;
import com.woyao.core.model.RegisterResponse;

import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;

/**
 * Created by summerwind on 2016-05-11.
 */
public interface AccountService {
    /**
     * 登录
     * @param userId
     * @return
     */
    @POST("checkversion")
    @FormUrlEncoded
    Call<BaseResponse> checkVersion(@Field("userid")int userId, @Field("version")String version);

    /**
     * 登录
     * @param username
     * @param password
     * @return
     */
    @POST("UserLoginService")
    @FormUrlEncoded
    Call<LoginResponse> login(@Field("emailmobile")String username, @Field("pwd")String password);

    @FormUrlEncoded
    @POST("setpassword")
    Call<BaseResponse> setPassword(@Field("userid")int userId,
                                   @Field("old")String oldPwd,
                                   @Field("old")String newPwd);

    /**
     * 获取帐号信息
     * @param userId
     * @param source
     * @return
     */
    @POST("getprofile")
    @FormUrlEncoded
    Call<ProfileResponse> getProfile(@Field("userid")int userId,@Field("source")String source);


    /**
     * 设置用户
     * @param userId
     * @param attr
     * @param content
     * @return
     */
    @POST("setprofileattr")
    @FormUrlEncoded
    Call<BaseResponse> setProfileAttr(@Field("userid")int userId,
                                      @Field("attr")String attr,
                                      @Field("content")String content);

    /**
     * 发送验证码
     * @param username
     * @param code
     * @return
     */
    @POST("sendcode")
    @FormUrlEncoded
    Call<BaseResponse> sendCode(@Field("mobile")String username, @Field("code")String code);


    /**
     * 注册
     * @param username
     * @param password
     * @param rid
     * @return
     */
    @POST("register")
    @FormUrlEncoded
    Call<RegisterResponse> register(@Field("mobile")String username, @Field("password")String password, @Field("rid")String rid,@Field("lng") String longitude,
                                    @Field("lat")String latitude);

    /**
     * 忘记密码
     * @param username
     * @param password
     * @return
     */
    @POST("resetpassword")
    @FormUrlEncoded
    Call<BaseResponse> resetPassword(@Field("mobile")String username, @Field("new")String password);


    @FormUrlEncoded
    @POST("getmydemand")
    Call<GetMyDemandResponse> getMyDemand(@Field("userid")int userId );

    @POST("getdemand")
    @FormUrlEncoded
    Call<GetDemandResponse> getDemand(@Field("userid")int userId, @Field("id")int demandId);

    @POST("adddemand")
    @FormUrlEncoded
    Call<BaseResponse> addDemand(@Field("userid")int userId
            , @Field("member_id")int member_id
            , @Field("how")String how
            , @Field("image")String image
            , @Field("title")String title
            , @Field("description")String description
            , @Field("include")String include
            , @Field("relation")String relation
            , @Field("budget")float budget
            , @Field("charge")float charge
            , @Field("bidding")float bidding);


    @POST("setdemandattr")
    @FormUrlEncoded
    Call<BaseResponse> setDemandAttr(@Field("userid")int userId,
                                     @Field("id")Integer id,
                                     @Field("attr")String attr,
                                     @Field("content")String content,
                                     @Field("act")String act);



    @FormUrlEncoded
    @POST("getmymember")
    Call<GetMyMemberResponse> getMyMember(@Field("userid")int userId);

    @FormUrlEncoded
    @POST("getmember")
    Call<GetMemberResponse> getMember(@Field("userid")int userId,@Field("id")int id);


    @POST("setmemberattr")
    @FormUrlEncoded
    Call<BaseResponse> setMemberAttr(@Field("userid")int userId,
                                     @Field("id")Integer id,
                                     @Field("attr")String attr,
                                     @Field("content")String content);

    @POST("addmember")
    @FormUrlEncoded
    Call<BaseResponse> addMember(@Field("userid")int userId,@Field("orgid")String orgid,
                                     @Field("orgtitle")String orgtitle,@Field("role")String role);


    @POST("deletemember")
    @FormUrlEncoded
    Call<BaseResponse> deleteMember(@Field("userid")int userId,@Field("id")int id);

    @POST("searchorg")
    @FormUrlEncoded
    Call<GetMyCompanyResponse> searchOrg(@Field("userid")int userId,
                                                 @Field("keyword")String keyword);

    @POST("getorg")
    @FormUrlEncoded
    Call<GetOrgResponse> getOrg(@Field("userid")int userId,
                                   @Field("id")Integer id);


    @POST("setorgattr")
    @FormUrlEncoded
    Call<BaseResponse> setOrgAttr(@Field("userid")int userId,
                                     @Field("id")Integer id,
                                     @Field("attr")String attr,
                                     @Field("content")String content);

    /**
     * 举报
     * @param userId
     * @param mid
     * @return
     */
    @POST("talk")
    @FormUrlEncoded
    Call<BaseResponse> talk(@Field("userid") int userId, @Field("mid")int mid, @Field("content")String content);

    /**
     * 举报
     * @param userId
     * @param mid
     * @return
     */
    @POST("getmessage")
    @FormUrlEncoded
    Call<GetMessageResponse> getMessage(@Field("userid") int userId, @Field("mid")int mid );

    @FormUrlEncoded
    @POST("getmycontact")
    Call<GetMyContactResponse> getMyContacts(@Field("userid")int userId  , @Field("keyword")String keyword);


    @FormUrlEncoded
    @POST("getcontact")
    Call<GetContactResponse> getContact(@Field("userid")int userId, @Field("id")String id);

    @POST("setcontactattr")
    @FormUrlEncoded
    Call<BaseResponse> setContactAttr(@Field("userid")int userId,
                                       @Field("id")String id,
                                       @Field("attr")String attr,
                                       @Field("content")String content);

    @FormUrlEncoded
    @POST("getmyrelation")
    Call<GetMyRelationResponse> getMyRelation(@Field("userid")int userId);


    @FormUrlEncoded
    @POST("getrelation")
    Call<GetRelationResponse> getRelation(@Field("userid")int userId, @Field("id")int relation_id);

    @POST("setrelationattr")
    @FormUrlEncoded
    Call<BaseResponse> setRelationAttr(@Field("userid")int userId,
                                  @Field("id")Integer id,
                                  @Field("attr")String attr,
                                  @Field("content")String content);


    @POST("addrelation")
    @FormUrlEncoded
    Call<BaseResponse> addRelation(@Field("userid")int userId,
                                       @Field("id")String id,
                                       @Field("demand_id")Integer demand_id,
                                       @Field("how")String how,
                                       @Field("member_id")Integer member_id,
                                       @Field("status")String status,
                                       @Field("tag")String tag);

    @FormUrlEncoded
    @POST("getorder")
    Call<BaseResponse> getOrder(@Field("userid")int userId,
                                        @Field("fee")String fee);

    @FormUrlEncoded
    @POST("getbalance")
    Call<GetBalanceResponse> getBalance(@Field("userid")int userId);

    String TYPE_DEFER="defer";
    String TYPE_APPLY="apply";
    String TYPE_ACCEPT = "accept";
    String TYPE_HISTORY = "history";

}
